package com.chuhe.lottery.service.adapter;

import com.chuhe.lottery.domain.constans.LotteryConstans;
import com.chuhe.lottery.domain.entity.Winners;

import java.util.HashMap;

/**
 * @Author: 楚河
 * @Date: 2025年06月03日18:06
 */
public class WinnersAdaper {

    /**
     * 组装获奖数据
     * @Author: 楚河
     * @Date: 2025-06-03 18:15
     */
    public static Winners buildWinnerUserInfo(int userId, String name, int winnerNum) {
        if (winnerNum < LotteryConstans.INT_1) {
            throw new IllegalArgumentException("获奖信息异常");
        }

        String awardName;

        switch(winnerNum) {
            case LotteryConstans.INT_1:
                awardName = "一等奖";
                break;
            case LotteryConstans.INT_2:
                awardName = "二等奖";
                break;
            case LotteryConstans.INT_3:
                awardName = "三等奖";
                break;
            default:
                awardName = "未知奖项";
        }

        return Winners.builder()
                .userId(userId)
                .name(name)
                .awards(awardName)
                .build();
    }
}
